package com.tsing.mvc.config;

//import com.tsing.mvc.filter.MyFilter;
import com.tsing.mvc.filter.MyFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * 添加自定义过滤器到过滤器链中
 */
@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean registrationBean1() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new MyFilter());
        filterRegistrationBean.addUrlPatterns("/*");
        // filterRegistrationBean.setName("xxx");  //可设置过滤器名字

        return filterRegistrationBean;
    }
}
